
(* Echange de 2 variables  (* procédure à plusieurs arguments *) *)

let a : int ref = ref 0 in
let b : int ref = ref 0 in

let swap (x:int ref) (y:int ref) = 
    let z : int ref = ref (-1) in
      begin
        z := !x;
        x := !y;
        y := !z
      end
in
begin
  print_string "entrer l'entier a ";
  a := read_int();
  print_string "entrer l'entier b ";
  b := read_int();
  swap(a)(b);
  print_string "a = ";
  print_int !a;
  print_string "\n";
  print_string "b = ";
  print_int !b;
  print_string "\n"
end
;;
